/*     */ import java.awt.Color;
/*     */ import java.awt.Container;
/*     */ import java.awt.Dimension;
/*     */ import java.awt.Font;
/*     */ import java.awt.Graphics;
/*     */ import java.awt.Graphics2D;
/*     */ import java.awt.Insets;
/*     */ import java.awt.event.ActionEvent;
/*     */ import java.awt.event.ActionListener;
/*     */ import java.awt.event.MouseEvent;
/*     */ import java.awt.event.MouseMotionListener;
import java.awt.geom.Line2D;
/*     */ import java.awt.geom.Line2D.Double;
/*     */ import java.text.DecimalFormat;
/*     */ import java.util.Arrays;
/*     */ import java.util.List;
/*     */ import javax.swing.BorderFactory;
/*     */ import javax.swing.Box;
/*     */ import javax.swing.BoxLayout;
/*     */ import javax.swing.JButton;
/*     */ import javax.swing.JDialog;
/*     */ import javax.swing.JFrame;
/*     */ import javax.swing.JLabel;
/*     */ import javax.swing.JOptionPane;
/*     */ import javax.swing.JPanel;
/*     */ import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
/*     */ 
/*     */ public class ROCChart extends JPanel
/*     */   implements MouseMotionListener, BBIInterface, ActionListener
/*     */ {
/*     */   private SymQuotes sq;
/*     */   private String sym;
/*  14 */   private float yScale = 1.0F;
/*  15 */   private float xScale = 1.0F;
/*     */   private double stickWidth;
/*     */   private float minVal;
/*     */   private float maxVal;
/*     */   private int parm1;
/*     */   private int parm2;
/*     */   private float[] roc_parm1;
/*     */   private float[] rocMA_parm2;
/*  21 */   private String m = "";
/*     */   private int mX;
/*     */   private int mY;
/*  23 */   public int noOfDays = 150;
/*     */   private double p1Y;
/*     */   private double p2Y;
/*     */   private double p11Y;
/*     */   private double p22Y;
/*     */   private double p0Y;
/*     */   private JTextField parm1TF;
/*     */   private JTextField parm2TF;
/*     */   private JButton chgParmOk;
/*     */   private JButton chgParmCancel;
/*     */   private JButton defaultParms;
/*     */   private JDialog chgParmDialog;
/*  31 */   private DecimalFormat df = new DecimalFormat("0.00");
/*     */ 
/*  33 */   public String trend = "";
/*     */   public ROCChart.EastPanel ep;
/*     */   private double refY;
/*     */   private double refX;
/* 521 */   private Font ssp10 = new Font("SansSerif", 0, 10);
/* 522 */   private Font ssp9 = new Font("SansSerif", 0, 9);
/* 523 */   private Line2D.Double refL1 = new Line2D.Double();
/* 524 */   private Line2D.Double refL2 = new Line2D.Double();
/* 525 */   private Line2D.Double gridY = new Line2D.Double();
/* 526 */   private Line2D.Double gridX = new Line2D.Double();
/* 527 */   private Line2D.Double yrefL1 = new Line2D.Double();
/* 528 */   private Line2D.Double yrefL2 = new Line2D.Double();
/*     */   private double yfactor;
/*     */   private double startPointX;
/*     */   private int dateRef;
/*     */   private int daysRef;
/* 533 */   private Line2D.Double l0 = new Line2D.Double();
/* 534 */   private Line2D.Double l1 = new Line2D.Double();
/* 535 */   private Line2D.Double l2 = new Line2D.Double();
/*     */   private double x1;
/*     */   private double y1;
/*     */   private double x2;
/*     */   private double y2;
/*     */   private double u1;
/*     */   private double v1;
/*     */   private double u2;
/*     */   private double v2;
/*     */   private double a1;
/*     */   private double b1;
/*     */   private double a2;
/*     */   private double b2;
/*     */   private double xi;
/*     */   private double yi;
/* 537 */   private Line2D.Double uA = new Line2D.Double();
/* 538 */   private Line2D.Double lA = new Line2D.Double();
/* 539 */   private Line2D.Double hA = new Line2D.Double();
/*     */ 
/*     */   public ROCChart(SymQuotes paramSymQuotes, int paramInt1, int paramInt2)
/*     */   {
/*  38 */     this.sq = paramSymQuotes;
/*  39 */     this.sym = paramSymQuotes.sym;
/*     */ 
/*  41 */     this.roc_parm1 = new float[paramSymQuotes.count];
/*  42 */     this.rocMA_parm2 = new float[paramSymQuotes.count];
/*     */ 
/*  44 */     this.parm1 = paramInt1;
/*  45 */     this.parm2 = paramInt2;
/*     */ 
/*  47 */     if (this.noOfDays == 150)
/*  48 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else {
/*  50 */       this.stickWidth = (1.5D * this.xScale);
/*     */     }
/*  52 */     setBackground(Color.black);
/*  53 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */ 
/*  55 */     if (paramInt1 < paramSymQuotes.count) {
/*  56 */       roc_parm1Finder();
/*     */     }
/*  58 */     if (paramInt1 + paramInt2 < paramSymQuotes.count) {
/*  59 */       rocMA_parm2Finder();
/*     */     }
/*  61 */     findMinMax();
/*  62 */     addMouseMotionListener(this);
/*     */ 
/*  64 */     if (this.roc_parm1[(paramSymQuotes.count - 1)] >= this.rocMA_parm2[(paramSymQuotes.count - 1)])
/*  65 */       this.trend = "Bullish";
/*     */     else {
/*  67 */       this.trend = "Bearish";
/*     */     }
/*  69 */     this.ep = new ROCChart.EastPanel();
/*     */   }
/*     */ 
/*     */   public int getBBIdata(int paramInt)
/*     */   {
/*  76 */     if (this.roc_parm1[paramInt] >= this.rocMA_parm2[paramInt]) {
/*  77 */       return 1;
/*     */     }
/*  79 */     return 0;
/*     */   }
/*     */ 
/*     */   public void changeNoOfDays(int paramInt)
/*     */   {
/*  86 */     this.noOfDays = paramInt;
/*     */ 
/*  88 */     if (paramInt == 150)
/*  89 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/*  91 */       this.stickWidth = (1.5D * this.xScale);
/*  92 */     findMinMax();
/*     */   }
/*     */ 
/*     */   public void redrawChart(SymQuotes paramSymQuotes)
/*     */   {
/*  99 */     this.sq = paramSymQuotes;
/* 100 */     this.sym = paramSymQuotes.sym;
/*     */ 
/* 102 */     this.roc_parm1 = new float[paramSymQuotes.count];
/* 103 */     this.rocMA_parm2 = new float[paramSymQuotes.count];
/*     */ 
/* 105 */     if (this.noOfDays == 150)
/* 106 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else {
/* 108 */       this.stickWidth = (1.5D * this.xScale);
/*     */     }
/* 110 */     if (this.parm1 < paramSymQuotes.count) {
/* 111 */       roc_parm1Finder();
/*     */     }
/* 113 */     if (this.parm1 + this.parm2 < paramSymQuotes.count) {
/* 114 */       rocMA_parm2Finder();
/*     */     }
/* 116 */     findMinMax();
/*     */ 
/* 118 */     if (this.roc_parm1[(paramSymQuotes.count - 1)] >= this.rocMA_parm2[(paramSymQuotes.count - 1)])
/* 119 */       this.trend = "Bullish";
/*     */     else {
/* 121 */       this.trend = "Bearish";
/*     */     }
/* 123 */     repaint();
/* 124 */     this.ep.updateValues();
/*     */   }
/*     */ 
/*     */   public void redrawChart()
/*     */   {
/* 131 */     if (this.parm1 < this.sq.count)
/* 132 */       roc_parm1Finder();
/*     */     else {
/* 134 */       Arrays.fill(this.roc_parm1, 0.0F);
/*     */     }
/* 136 */     if (this.parm1 + this.parm2 < this.sq.count)
/* 137 */       rocMA_parm2Finder();
/*     */     else {
/* 139 */       Arrays.fill(this.rocMA_parm2, 0.0F);
/*     */     }
/* 141 */     findMinMax();
/*     */ 
/* 143 */     if (this.roc_parm1[(this.sq.count - 1)] >= this.rocMA_parm2[(this.sq.count - 1)])
/* 144 */       this.trend = "Bullish";
/*     */     else {
/* 146 */       this.trend = "Bearish";
/*     */     }
/* 148 */     repaint();
/* 149 */     this.ep.updateValues();
/*     */   }
/*     */ 
/*     */   public void mouseMoved(MouseEvent paramMouseEvent)
/*     */   {
/* 157 */     int j = 1;
/* 158 */     if ((paramMouseEvent.getX() >= 50) && (paramMouseEvent.getX() <= 750.0F * this.xScale + 50.0F) && (paramMouseEvent.getY() >= 10) && (paramMouseEvent.getY() <= this.yScale * 100.0F + 10.0F))
/*     */     {
/* 160 */       int i = (int)((750.0F * this.xScale - (paramMouseEvent.getX() - 50) - this.stickWidth / 2.0D) / (this.stickWidth + 1.0F * this.xScale));
/*     */ 
/* 162 */       if (this.sq.count - 1 >= i)
/*     */       {
/* 164 */         j = this.sq.count - 1 - i;
/* 165 */         this.m = ("( " + (String)this.sq.date.get(j) + ", ROC[" + this.parm1 + "]:" + this.df.format(this.roc_parm1[j]) + "  ROC MA[" + this.parm2 + "]:" + this.df.format(this.rocMA_parm2[j]) + " )");
/*     */ 
/* 167 */         this.mX = paramMouseEvent.getX();
/* 168 */         this.mY = paramMouseEvent.getY();
/* 169 */         repaint();
/* 170 */         return;
/*     */       }
/*     */ 
/* 174 */       this.m = "";
/*     */ 
/* 176 */       repaint();
/* 177 */       return;
/*     */     }
/*     */ 
/* 181 */     this.m = "";
/* 182 */     repaint();
/*     */   }
/*     */ 
/*     */   public void mouseDragged(MouseEvent paramMouseEvent)
/*     */   {
/*     */   }
/*     */ 
/*     */   private void drawValues(Graphics2D paramGraphics2D)
/*     */   {
/* 195 */     paramGraphics2D.setPaint(Color.cyan);
/*     */ 
/* 197 */     if (this.mX + this.m.length() * 5 > 750.0F * this.xScale + 50.0F) {
/* 198 */       this.mX -= this.m.length() * 5;
/*     */     }
/* 200 */     paramGraphics2D.drawString(this.m, this.mX, this.mY);
/*     */   }
/*     */ 
/*     */   private void roc_parm1Finder()
/*     */   {
/* 207 */     for (int i = 0; i < this.parm1; i++) {
/* 208 */       this.roc_parm1[i] = 0.0F;
/*     */     }
/* 210 */     for (int i = this.parm1; i < this.sq.count; i++)
/*     */     {
/* 212 */       this.roc_parm1[i] = ((((Float)this.sq.close.get(i)).floatValue() - ((Float)this.sq.close.get(i - (this.parm1 - 1))).floatValue()) / ((Float)this.sq.close.get(i - (this.parm1 - 1))).floatValue() * 100.0F);
/*     */     }
/*     */   }
/*     */ 
/*     */   private void rocMA_parm2Finder()
/*     */   {
/* 221 */     for (int i = 0; i < this.parm1 + this.parm2; i++) {
/* 222 */       this.rocMA_parm2[i] = 0.0F;
/*     */     }
/* 224 */     for (int i = this.parm1 + this.parm2; i < this.sq.count; i++)
/*     */     {
/* 226 */       float f = 0.0F;
/* 227 */       for (int j = i; j > i - this.parm2; j--)
/*     */       {
/* 229 */         f += this.roc_parm1[j];
/*     */       }
/*     */ 
/* 232 */       this.rocMA_parm2[i] = (f / this.parm2);
/*     */     }
/*     */   }
/*     */ 
/*     */   private void findMinMax()
/*     */   {
/* 240 */     int i = 1;
/* 241 */     this.minVal = this.roc_parm1[(this.sq.count - 1)];
/* 242 */     this.maxVal = this.roc_parm1[(this.sq.count - 1)];
/*     */ 
/* 244 */     for (int j = this.sq.count - 1; j >= this.parm1; j--)
/*     */     {
/* 246 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 249 */       if (this.minVal > this.roc_parm1[j]) {
/* 250 */         this.minVal = this.roc_parm1[j];
/*     */       }
/* 252 */       if (this.maxVal < this.roc_parm1[j]) {
/* 253 */         this.maxVal = this.roc_parm1[j];
/*     */       }
/* 255 */       i += 1;
/*     */     }
/*     */ 
/* 259 */     i = 1;
/* 260 */     for (int j = this.sq.count - 1; j >= this.parm1 + this.parm2; j--)
/*     */     {
/* 262 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 265 */       if (this.minVal > this.rocMA_parm2[j]) {
/* 266 */         this.minVal = this.rocMA_parm2[j];
/*     */       }
/* 268 */       if (this.maxVal < this.rocMA_parm2[j]) {
/* 269 */         this.maxVal = this.rocMA_parm2[j];
/*     */       }
/* 271 */       i += 1;
/*     */     }
/*     */   }
/*     */ 
/*     */   public void updateParms(int paramInt1, int paramInt2)
/*     */   {
/* 281 */     this.parm1 = paramInt1;
/* 282 */     this.parm2 = paramInt2;
/*     */ 
/* 284 */     roc_parm1Finder();
/* 285 */     rocMA_parm2Finder();
/* 286 */     findMinMax();
/*     */   }
/*     */ 
/*     */   public Box getROCBox(boolean paramBoolean)
/*     */   {
/* 293 */     Box localBox = Box.createHorizontalBox();
/* 294 */     TitledBorder localTitledBorder = BorderFactory.createTitledBorder("ROC");
/*     */ 
/* 296 */     this.parm1TF = new JTextField("" + this.parm1, 2);
/* 297 */     this.parm2TF = new JTextField("" + this.parm2, 2);
/* 298 */     this.parm1TF.setFont(this.ssp10);
/* 299 */     this.parm2TF.setFont(this.ssp10);
/* 300 */     this.parm1TF.setMaximumSize(new Dimension(25, 20));
/* 301 */     this.parm2TF.setMaximumSize(new Dimension(25, 20));
/*     */ 
/* 303 */     JLabel localJLabel1 = new JLabel("ROC[");
/* 304 */     JLabel localJLabel2 = new JLabel("] ,  ROC MA[");
/* 305 */     JLabel localJLabel3 = new JLabel("]     ");
/*     */ 
/* 307 */     localJLabel1.setFont(this.ssp10);
/* 308 */     localJLabel2.setFont(this.ssp10);
/* 309 */     localJLabel3.setFont(this.ssp10);
/*     */ 
/* 311 */     localBox.add(localJLabel1);
/* 312 */     localBox.add(this.parm1TF);
/* 313 */     localBox.add(localJLabel2);
/* 314 */     localBox.add(this.parm2TF);
/* 315 */     localBox.add(localJLabel3);
/*     */ 
/* 317 */     localBox.add(Box.createHorizontalGlue());
/*     */ 
/* 319 */     if (paramBoolean) {
/* 320 */       localBox.setBorder(localTitledBorder);
/*     */     }
/* 322 */     return localBox;
/*     */   }
/*     */ 
/*     */   public void showChgParmDialog()
/*     */   {
/* 329 */     JFrame localJFrame = new JFrame();
/* 330 */     this.chgParmDialog = new JDialog(localJFrame, "Change ROC Parameters", true);
/* 331 */     Box localBox1 = Box.createVerticalBox();
/* 332 */     Box localBox2 = Box.createHorizontalBox();
/*     */ 
/* 334 */     this.chgParmOk = new JButton("OK");
/* 335 */     this.chgParmOk.setFont(this.ssp10);
/* 336 */     this.chgParmOk.setMargin(new Insets(1, 2, 1, 2));
/* 337 */     this.chgParmOk.addActionListener(this);
/*     */ 
/* 339 */     this.chgParmCancel = new JButton("Cancel");
/* 340 */     this.chgParmCancel.setFont(this.ssp10);
/* 341 */     this.chgParmCancel.setMargin(new Insets(1, 2, 1, 2));
/* 342 */     this.chgParmCancel.addActionListener(this);
/*     */ 
/* 344 */     this.defaultParms = new JButton("Default");
/* 345 */     this.defaultParms.setFont(this.ssp10);
/* 346 */     this.defaultParms.setMargin(new Insets(1, 2, 1, 2));
/* 347 */     this.defaultParms.setToolTipText("Reset to default parameters");
/* 348 */     this.defaultParms.addActionListener(this);
/*     */ 
/* 350 */     localBox2.add(Box.createHorizontalGlue());
/* 351 */     localBox2.add(this.chgParmOk);
/* 352 */     localBox2.add(Box.createHorizontalStrut(5));
/* 353 */     localBox2.add(this.chgParmCancel);
/* 354 */     localBox2.add(Box.createHorizontalStrut(5));
/* 355 */     localBox2.add(this.defaultParms);
/* 356 */     localBox2.add(Box.createHorizontalGlue());
/*     */ 
/* 358 */     localBox1.add(getROCBox(true));
/* 359 */     localBox1.add(localBox2);
/*     */ 
/* 361 */     this.chgParmDialog.getContentPane().add(localBox1);
/* 362 */     this.chgParmDialog.setSize(250, 100);
/* 363 */     this.chgParmDialog.setLocationRelativeTo(this.ep);
/* 364 */     this.chgParmDialog.setVisible(true);
/*     */   }
/*     */ 
/*     */   public boolean validateParm()
/*     */   {
/* 371 */     int i = this.parm1;
/* 372 */     int j = this.parm2;
/*     */     try
/*     */     {
/* 376 */       i = Integer.parseInt(this.parm1TF.getText().trim());
/* 377 */       j = Integer.parseInt(this.parm2TF.getText().trim());
/*     */     }
/*     */     catch (NumberFormatException localNumberFormatException)
/*     */     {
/* 383 */       JOptionPane.showMessageDialog(null, "Error in ROC parameter.Enter only numbers greater than 2.", null, 0);
/*     */ 
/* 386 */       this.parm1TF.setText("" + this.parm1);
/* 387 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 389 */       return false;
/*     */     }
/*     */ 
/* 393 */     if ((i > 200) || (j > 200))
/*     */     {
/* 395 */       JOptionPane.showMessageDialog(null, "Error in ROC parameter.Enter values between 2 and 200.", null, 0);
/*     */ 
/* 398 */       this.parm1TF.setText("" + this.parm1);
/* 399 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 401 */       return false;
/*     */     }
/*     */ 
/* 405 */     if ((i < 2) || (j < 2))
/*     */     {
/* 407 */       JOptionPane.showMessageDialog(null, "Error in ROC parameter.Enter values between 2 and 200.", null, 0);
/*     */ 
/* 410 */       this.parm1TF.setText("" + this.parm1);
/* 411 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 413 */       return false;
/*     */     }
/*     */ 
/* 417 */     this.parm1 = i;
/* 418 */     this.parm2 = j;
/*     */ 
/* 420 */     return true;
/*     */   }
/*     */ 
/*     */   public void actionPerformed(ActionEvent paramActionEvent)
/*     */   {
/* 427 */     if (paramActionEvent.getSource() == this.chgParmOk)
/*     */     {
/* 429 */       if (!validateParm()) {
/* 430 */         return;
/*     */       }
/* 432 */       redrawChart();
/* 433 */       this.chgParmDialog.dispose();
/*     */     }
/*     */ 
/* 437 */     if (paramActionEvent.getSource() == this.chgParmCancel)
/*     */     {
/* 439 */       this.chgParmDialog.dispose();
/*     */     }
/*     */ 
/* 443 */     if (paramActionEvent.getSource() == this.defaultParms)
/*     */     {
/* 445 */       this.parm1TF.setText("10");
/* 446 */       this.parm2TF.setText("8");
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setDefaultParms()
/*     */   {
/* 455 */     this.parm1TF.setText("10");
/* 456 */     this.parm2TF.setText("8");
/*     */   }
/*     */ 
/*     */   public void vZoom(boolean paramBoolean)
/*     */   {
/* 463 */     if (paramBoolean)
/* 464 */       this.yScale += 0.2F;
/* 465 */     else if (this.yScale >= 1.2F) {
/* 466 */       this.yScale -= 0.2F;
/*     */     }
/* 468 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   public void hZoom(boolean paramBoolean)
/*     */   {
/* 475 */     if (paramBoolean)
/* 476 */       this.xScale += 0.2F;
/* 477 */     else if (this.xScale >= 1.2F) {
/* 478 */       this.xScale -= 0.2F;
/*     */     }
/* 480 */     if (this.noOfDays == 150)
/* 481 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/* 483 */       this.stickWidth = (1.5D * this.xScale);
/* 484 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   public void resetZoom()
/*     */   {
/* 491 */     this.yScale = 1.0F;
/* 492 */     this.xScale = 1.0F;
/* 493 */     if (this.noOfDays == 150)
/* 494 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/* 496 */       this.stickWidth = (1.5D * this.xScale);
/* 497 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   protected void clear(Graphics paramGraphics)
/*     */   {
/* 504 */     super.paintComponent(paramGraphics);
/*     */   }
/*     */ 
/*     */   protected void paintComponent(Graphics paramGraphics)
/*     */   {
/* 511 */     clear(paramGraphics);
/* 512 */     Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
/* 513 */     drawChart(localGraphics2D);
/* 514 */     drawValues(localGraphics2D);
/*     */   }
/*     */ 
/*     */   private void drawChart(Graphics2D paramGraphics2D)
/*     */   {
/* 544 */     this.refY = 10.0D;
/* 545 */     this.refX = 50.0D;
/* 546 */     setFont(this.ssp10);
/* 547 */     String str = "Price Rate of Change";
/* 548 */     paramGraphics2D.setPaint(new Color(100, 240, 250));
/* 549 */     paramGraphics2D.drawString(str, 50, 10);
/*     */ 
/* 551 */     str = "ROC[" + this.parm1 + "]";
/* 552 */     paramGraphics2D.setPaint(new Color(80, 150, 125));
/* 553 */     paramGraphics2D.drawString(str, 160, 10);
/*     */ 
/* 555 */     str = "ROC MA[" + this.parm2 + "]";
/* 556 */     paramGraphics2D.setPaint(new Color(210, 210, 20));
/* 557 */     paramGraphics2D.drawString(str, 210, 10);
/*     */ 
/* 560 */     this.refL1.setLine(50.0D, 10.0D, 50.0D, this.yScale * 100.0F + 10.0F);
/* 561 */     this.refL2.setLine(750.0F * this.xScale + 50.0F, 10.0D, 750.0F * this.xScale + 50.0F, this.yScale * 100.0F + 10.0F);
/* 562 */     paramGraphics2D.setPaint(Color.white);
/* 563 */     paramGraphics2D.draw(this.refL1);
/* 564 */     paramGraphics2D.draw(this.refL2);
/*     */ 
/* 566 */     for (int i = 0; i < 14; i++)
/*     */     {
/* 568 */       this.refX += 50.0F * this.xScale;
/* 569 */       this.gridY.setLine(this.refX, 10.0D, this.refX, this.yScale * 100.0F + 10.0F);
/* 570 */       paramGraphics2D.setPaint(Color.darkGray);
/* 571 */       paramGraphics2D.draw(this.gridY);
/*     */     }
int i;
/*     */ 
/* 575 */     for (i = 0; i < 11; i++)
/*     */     {
/* 577 */       this.yrefL1.setLine(50.0D, this.refY, 40.0D, this.refY);
/* 578 */       str = this.df.format(this.maxVal - (this.maxVal - this.minVal) / 10.0F * i);
/* 579 */       paramGraphics2D.setPaint(Color.lightGray);
/* 580 */       paramGraphics2D.drawString(str, 10, (int)this.refY);
/* 581 */       this.yrefL2.setLine(750.0F * this.xScale + 50.0F, this.refY, 750.0F * this.xScale + 60.0F, this.refY);
/*     */ 
/* 583 */       paramGraphics2D.drawString(str, (int)(750.0F * this.xScale + 53.0F), (int)this.refY);
/* 584 */       this.gridX.setLine(50.0D, this.refY, 750.0F * this.xScale + 50.0F, this.refY);
/* 585 */       paramGraphics2D.setPaint(Color.white);
/* 586 */       paramGraphics2D.draw(this.yrefL1);
/* 587 */       paramGraphics2D.draw(this.yrefL2);
/* 588 */       paramGraphics2D.setPaint(Color.darkGray);
/* 589 */       paramGraphics2D.draw(this.gridX);
/* 590 */       this.refY += 10.0F * this.yScale;
/*     */     }
/*     */ 
/* 594 */     this.yfactor = (this.yScale * 100.0F / (this.maxVal - this.minVal));
/* 595 */     this.startPointX = (750.0F * this.xScale + 50.0F - (this.stickWidth + 1.0F * this.xScale));
/* 596 */     this.dateRef = (this.sq.count - 1);
/* 597 */     this.daysRef = 1;
/*     */ 
/* 600 */     this.p0Y = (this.yScale * 100.0F + 10.0F - (0.0F - this.minVal) * this.yfactor);
/* 601 */     this.l0.setLine(50.0D, this.p0Y, 750.0F * this.xScale + 50.0F, this.p0Y);
/* 602 */     paramGraphics2D.setPaint(Color.white);
/* 603 */     paramGraphics2D.draw(this.l0);
/*     */ 
/* 606 */     for (i = this.sq.count - 1; i > this.parm1; i--)
/*     */     {
/* 608 */       if (this.daysRef == this.noOfDays)
/*     */         break;
/* 610 */       paramGraphics2D.setFont(new Font("SansSerif", 0, 10));
/*     */ 
/* 613 */       if (i > this.parm1 + this.parm2)
/*     */       {
/* 615 */         this.p1Y = (this.yScale * 100.0F + 10.0F - (this.rocMA_parm2[i] - this.minVal) * this.yfactor);
/* 616 */         this.p2Y = (this.yScale * 100.0F + 10.0F - (this.rocMA_parm2[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 618 */         this.l1.setLine(this.startPointX, this.p1Y, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p2Y);
/* 619 */         paramGraphics2D.setPaint(new Color(210, 210, 20));
/* 620 */         paramGraphics2D.draw(this.l1);
/*     */       }
/*     */ 
/* 624 */       if (i > this.parm1)
/*     */       {
/* 626 */         this.p11Y = (this.yScale * 100.0F + 10.0F - (this.roc_parm1[i] - this.minVal) * this.yfactor);
/* 627 */         this.p22Y = (this.yScale * 100.0F + 10.0F - (this.roc_parm1[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 629 */         this.l2.setLine(this.startPointX, this.p11Y, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p22Y);
/* 630 */         paramGraphics2D.setPaint(new Color(80, 150, 125));
/* 631 */         paramGraphics2D.draw(this.l2);
/*     */       }
/*     */ 
/* 635 */       if ((i > this.parm1 + this.parm2) && (this.roc_parm1[i] - this.rocMA_parm2[i] >= 0.0F) && (this.roc_parm1[(i - 1)] - this.rocMA_parm2[(i - 1)] < 0.0F))
/*     */       {
/* 637 */         this.x1 = this.startPointX;
/* 638 */         this.x2 = (this.startPointX - this.stickWidth - 1.0F * this.xScale);
/* 639 */         this.y1 = this.p1Y;
/* 640 */         this.y2 = this.p2Y;
/* 641 */         this.u1 = this.x1;
/* 642 */         this.u2 = this.x2;
/* 643 */         this.v1 = this.p11Y;
/* 644 */         this.v2 = this.p22Y;
/*     */ 
/* 646 */         this.b1 = ((this.y1 - this.y2) / (this.x1 - this.x2));
/* 647 */         this.a1 = (this.y1 - this.b1 * this.x1);
/*     */ 
/* 649 */         this.b2 = ((this.v1 - this.v2) / (this.u1 - this.u2));
/* 650 */         this.a2 = (this.v1 - this.b2 * this.u1);
/*     */ 
/* 652 */         this.xi = (-1.0D * (this.a1 - this.a2) / (this.b1 - this.b2));
/* 653 */         this.yi = (this.a1 + this.b1 * this.xi);
/*     */ 
/* 655 */         paramGraphics2D.setPaint(Color.green);
/* 656 */         this.uA.setLine(this.xi, this.yi - 5.0D, this.xi, this.yi + 5.0D);
/* 657 */         this.lA.setLine(this.xi, this.yi - 5.0D, this.xi - 3.0D, this.yi);
/* 658 */         this.hA.setLine(this.xi, this.yi - 5.0D, this.xi + 3.0D, this.yi);
/* 659 */         paramGraphics2D.draw(this.uA);
/* 660 */         paramGraphics2D.draw(this.lA);
/* 661 */         paramGraphics2D.draw(this.hA);
/*     */       }
/*     */ 
/* 665 */       if ((i > this.parm1 + this.parm2) && (this.roc_parm1[i] - this.rocMA_parm2[i] < 0.0F) && (this.roc_parm1[(i - 1)] - this.rocMA_parm2[(i - 1)] > 0.0F))
/*     */       {
/* 667 */         this.x1 = this.startPointX;
/* 668 */         this.x2 = (this.startPointX - this.stickWidth - 1.0F * this.xScale);
/* 669 */         this.y1 = this.p1Y;
/* 670 */         this.y2 = this.p2Y;
/* 671 */         this.u1 = this.x1;
/* 672 */         this.u2 = this.x2;
/* 673 */         this.v1 = this.p11Y;
/* 674 */         this.v2 = this.p22Y;
/*     */ 
/* 676 */         this.b1 = ((this.y1 - this.y2) / (this.x1 - this.x2));
/* 677 */         this.a1 = (this.y1 - this.b1 * this.x1);
/*     */ 
/* 679 */         this.b2 = ((this.v1 - this.v2) / (this.u1 - this.u2));
/* 680 */         this.a2 = (this.v1 - this.b2 * this.u1);
/*     */ 
/* 682 */         this.xi = (-1.0D * (this.a1 - this.a2) / (this.b1 - this.b2));
/* 683 */         this.yi = (this.a1 + this.b1 * this.xi);
/*     */ 
/* 685 */         paramGraphics2D.setPaint(Color.red);
/* 686 */         this.uA.setLine(this.xi, this.yi - 5.0D, this.xi, this.yi + 5.0D);
/* 687 */         this.lA.setLine(this.xi, this.yi + 5.0D, this.xi - 3.0D, this.yi);
/* 688 */         this.hA.setLine(this.xi, this.yi + 5.0D, this.xi + 3.0D, this.yi);
/* 689 */         paramGraphics2D.draw(this.uA);
/* 690 */         paramGraphics2D.draw(this.lA);
/* 691 */         paramGraphics2D.draw(this.hA);
/*     */       }
/*     */ 
/* 695 */       if (this.dateRef == i)
/*     */       {
/* 697 */         paramGraphics2D.setFont(this.ssp9);
/* 698 */         str = ((String)this.sq.date.get(i)).substring(0, 6);
/* 699 */         if (this.roc_parm1[i] >= this.rocMA_parm2[i])
/* 700 */           paramGraphics2D.setPaint(Color.green);
/*     */         else {
/* 702 */           paramGraphics2D.setPaint(Color.red);
/*     */         }
/* 704 */         paramGraphics2D.drawString(str, (int)this.startPointX, (int)(this.yScale * 100.0F + 20.0F));
/* 705 */         if (this.noOfDays == 150)
/* 706 */           this.dateRef -= 10;
/*     */         else
/* 708 */           this.dateRef -= 20;
/* 709 */         paramGraphics2D.setFont(this.ssp10);
/*     */       }
/*     */ 
/* 713 */       this.startPointX = (this.startPointX - this.stickWidth - 1.0F * this.xScale);
/* 714 */       this.daysRef += 1;
/*     */     }
/*     */   }
/*     */ 
/*     */   public static void main(String[] paramArrayOfString)
/*     */   {
/* 778 */     FileDownloader localFileDownloader = new FileDownloader();
/* 779 */     localFileDownloader.downloadFiles();
/* 780 */     SymQuotes localSymQuotes = new SymQuotes("WIPRO", localFileDownloader.datesToRead, 1, 1, "ns");
/*     */ 
/* 782 */     ROCChart localROCChart = new ROCChart(localSymQuotes, 10, 8);
/*     */ 
/* 784 */     JFrame localJFrame = new JFrame("Test");
/* 785 */     localJFrame.setDefaultCloseOperation(3);
/* 786 */     localJFrame.getContentPane().add(localROCChart);
/* 787 */     localJFrame.pack();
/* 788 */     localJFrame.setSize(850, 175);
/* 789 */     localJFrame.setVisible(true);
/*     */   }
/*     */ 
/*     */   public class EastPanel extends JPanel
/*     */   {
/*     */     private JLabel title;
/*     */     private JLabel rocL;
/*     */     private JLabel rocMaL;
/*     */     private JLabel trendL;
/*     */     private ChartHelpButton chb;
/* 726 */     private Font valuesF = new Font("Sanserif", 0, 11);
/* 727 */     public Box buttonsPanel = Box.createHorizontalBox();
/*     */ 
/*     */     public EastPanel()
/*     */     {
/* 731 */       this.title = new JLabel("ROC");
/* 732 */       this.rocL = new JLabel("ROC[" + ROCChart.this.parm1 + "]: " + ROCChart.this.df.format(ROCChart.this.roc_parm1[(ROCChart.this.sq.count - 1)]));
/* 733 */       this.rocMaL = new JLabel("ROC MA[" + ROCChart.this.parm2 + "]: " + ROCChart.this.df.format(ROCChart.this.rocMA_parm2[(ROCChart.this.sq.count - 1)]));
/*     */ 
/* 735 */       this.trendL = new JLabel("Trend: " + ROCChart.this.trend);
/* 736 */       this.chb = new ChartHelpButton("http://www.profitindicators.com/home/indicators/roc.htm", "Help on ROC");
/*     */ 
/* 738 */       this.chb.setFont(this.valuesF);
/*     */ 
/* 740 */       this.rocL.setFont(this.valuesF);
/* 741 */       this.rocMaL.setFont(this.valuesF);
/* 742 */       this.trendL.setFont(this.valuesF);
/*     */ 
/* 744 */       this.buttonsPanel.add(this.chb);
/* 745 */       this.buttonsPanel.add(Box.createHorizontalStrut(2));
/* 746 */       this.buttonsPanel.setAlignmentX(0.0F);
/*     */ 
/* 748 */       setLayout(new BoxLayout(this, 3));
/*     */ 
/* 750 */       add(this.title);
/* 751 */       add(this.rocL);
/* 752 */       add(this.rocMaL);
/* 753 */       add(new JLabel(" "));
/* 754 */       add(this.trendL);
/* 755 */       add(this.buttonsPanel);
/* 756 */       add(Box.createVerticalGlue());
/*     */ 
/* 758 */       setBackground(new Color(243, 245, 252));
/*     */     }
/*     */ 
/*     */     public void updateValues()
/*     */     {
/* 765 */       this.rocL.setText("ROC[" + ROCChart.this.parm1 + "]: " + ROCChart.this.df.format(ROCChart.this.roc_parm1[(ROCChart.this.sq.count - 1)]));
/* 766 */       this.rocMaL.setText("ROC MA[" + ROCChart.this.parm2 + "]: " + ROCChart.this.df.format(ROCChart.this.rocMA_parm2[(ROCChart.this.sq.count - 1)]));
/* 767 */       this.trendL.setText("Trend: " + ROCChart.this.trend);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Deebak\Downloads\profitindicatorsv2-05.jar
 * Qualified Name:     ROCChart
 * JD-Core Version:    0.6.0
 */